﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace AirlinePilotAcademy_WPF.UI_All.Subject
{
    /// <summary>
    /// Lógica de interacción para WatchUpdatedSubject.xaml
    /// </summary>
    public partial class WatchUpdatedSubject : Window
    {
        public WatchUpdatedSubject()
        {
            InitializeComponent();
            fillComboBox();
            this.Label_CommentSubjectMonth.Content = "Gestion: " + DateTime.Now.Month + "/" + DateTime.Now.Year;
            getSubjectMonth();
        }

        private void fillComboBox()
        {
            string Year = DateTime.Now.Year.ToString();
            for (int i = 1; i <= 12; i++)
            {
                this.ComboBox_Gestion.Items.Add(i + "-" + Year);
            }
            this.ComboBox_Gestion.SelectedIndex = DateTime.Now.Month-1;
        }

        private void getSubjectMonth()
        {
            this.DataGrid_FilterSubject.ItemsSource = DataAccess.SubjectDataAccess.getSubjectAvailableInMonth(ComboBox_Gestion.SelectedItem.ToString());
        }

        private void ComboBox_Gestion_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            getSubjectMonth();
        }
    }
}
